
#include "Test.h"

#if TEST_Display
#include <string.h>
#include <stdint.h>
#include "BSP.h"
#include "IO.h"
#include "GT20L16.h"

extern const unsigned char AsciiDot0816[]; 

// 汉字库: 宋体16.dot 纵向取模下高位,数据排列:从左到右从上到下         //
/////////////////////////////////////////////////////////////////////////
unsigned char const shen[] =          // 数据表
{
      0x10,0x22,0x64,0x0C,0x88,0x06,0x22,0x12,  //"深",
      0x0A,0xE2,0x0A,0x12,0x22,0x8A,0x06,0x00,
      0x04,0x04,0xFE,0x01,0x10,0x11,0x09,0x05,
      0x03,0xFF,0x03,0x05,0x09,0x19,0x09,0x00,
};

unsigned char const zhen[] =          // 数据表
{
      0x20,0x20,0x20,0xFF,0x20,0x30,0x20,0xFE,  //"圳",
      0x00,0x00,0xFC,0x00,0x00,0xFF,0x00,0x00,
      0x08,0x18,0x08,0x0F,0x04,0x44,0x30,0x0F,
      0x00,0x00,0x1F,0x00,0x00,0xFF,0x00,0x00,
};

unsigned char const chuan[] =          // 数据表
{
      0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, //"川",
      0xFC,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
      0x00,0x40,0x20,0x1F,0x00,0x00,0x00,0x00,
      0x1F,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
};

unsigned char const hang[] =          // 数据表
{
      0x80,0x80,0xFC,0x96,0xA5,0x84,0xFC,0x08,	//"航",
      0x08,0xC9,0x4A,0x4E,0xE8,0x4C,0x08,0x00,
      0x80,0x40,0x3F,0x02,0x44,0x80,0x7F,0x80,
      0x40,0x3F,0x00,0x00,0x3F,0x40,0x70,0x00,
};

unsigned char const dian[] =          // 数据表
{
      0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,	//"电",
      0x48,0x48,0x48,0xFC,0x08,0x00,0x00,0x00,
      0x00,0x07,0x02,0x02,0x02,0x02,0x3F,0x42,
      0x42,0x42,0x42,0x47,0x40,0x70,0x00,0x00,
};

unsigned char const zi[] =          // 数据表
{
      0x80,0x80,0x82,0x82,0x82,0x82,0x82,0xE2,	//"子",
      0xA2,0x92,0x8A,0x86,0x80,0xC0,0x80,0x00,
      0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

unsigned char const ke[] =          // 数据表
{
      0x24,0x24,0x24,0xA4,0xFE,0xA3,0x22,0x00,	//"科",
      0x24,0x48,0x00,0xFF,0x00,0x80,0x00,0x00,
      0x10,0x08,0x06,0x01,0xFF,0x00,0x01,0x02,
      0x02,0x02,0x02,0xFF,0x01,0x01,0x01,0x00,
};
 
unsigned char const ji[] =          // 数据表
{
      0x10,0x10,0x10,0xFF,0x10,0x10,0x88,0x88,	 //"技",
      0x88,0xFF,0x88,0x88,0x8C,0x08,0x00,0x00,
      0x04,0x44,0x82,0x7F,0x01,0x80,0x81,0x46,
      0x28,0x10,0x28,0x26,0x41,0xC0,0x40,0x00
};

unsigned char const gong[] =          // 数据表
{
      0x00,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,  //"工",
      0x04,0x04,0x04,0x04,0x06,0x04,0x00,0x00,
      0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,
      0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x00,
};

unsigned char const yi[] =          // 数据表
{
      0x04,0x04,0x24,0x24,0x24,0x2F,0x24,0xA4, //"艺",
      0x64,0x2F,0x04,0x04,0x04,0x06,0x04,0x00,
      0x00,0x00,0x70,0x88,0x84,0x82,0x81,0x80,
      0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00
};

unsigned char const ci[] =          // 数据表
{
      0x00,0x00,0x00,0xFE,0x42,0xC2,0x42,0x42, //尺
      0x42,0x42,0x42,0xFF,0x02,0x00,0x00,0x00,
      0x80,0x40,0x30,0x0F,0x00,0x01,0x02,0x04,
      0x08,0x10,0x20,0x20,0x40,0xC0,0x40,0x00,
};

unsigned char const chun[] =          // 数据表
{
      0x10,0x10,0x10,0x10,0x90,0x10,0x10,0x10,	// "寸",
      0x10,0xFF,0x10,0x10,0x10,0x18,0x10,0x00,
      0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x40,
      0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00
};

unsigned char const bing[] =          // 数据表	   并
{
      0x00,0x00,0x08,0x09,0x0A,0xFE,0x08,0x08,
      0x08,0x0C,0xFA,0x0B,0x08,0x88,0x00,0x00,
      0x01,0x01,0x81,0x41,0x31,0x0F,0x01,0x01,
      0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x00,
};

unsigned char const chuan1[] =          // 数据表
{
      0x00,0x00,0x3C,0x24,0x24,0x24,0x24,0xFF, //串
      0x24,0x24,0x24,0x24,0x3E,0x84,0x00,0x00,
      0x00,0x1F,0x09,0x09,0x09,0x09,0x09,0xFF,
      0x09,0x09,0x09,0x09,0x09,0x1F,0x01,0x00,
};

unsigned char const kou[] =          // 数据表
{
      0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04, //口
      0x04,0x04,0x04,0x04,0xFE,0x04,0x00,0x00,
      0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,
      0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,
};

unsigned char const shi[] =          // 数据表   视
{
      0x10,0x10,0x91,0xD6,0x30,0x10,0xFE,0x02,
      0x02,0xFA,0x02,0x02,0xFF,0x02,0x00,0x00,
      0x02,0x01,0x00,0xFF,0x01,0x82,0x47,0x30,
      0x0C,0x03,0x3E,0x40,0x47,0x40,0x70,0x00,
};

unsigned char const qu[] =          // 数据表   区
{
      0x00,0x00,0xFE,0x02,0x0A,0x12,0x22,0x42,
      0x82,0x42,0x22,0x12,0x1B,0x02,0x00,0x00,
      0x00,0x00,0x7F,0x40,0x48,0x44,0x42,0x41,
      0x40,0x41,0x42,0x46,0x4C,0x60,0x40,0x00,
};
unsigned char const dian2[] =          // 数据表   点
{
      0x00,0x00,0xC0,0x40,0x40,0x40,0x7F,0x48,
      0x48,0x48,0x48,0xE8,0x4C,0x08,0x00,0x00,
      0x80,0x40,0x37,0x04,0x14,0x64,0x04,0x14,
      0x24,0x64,0x04,0x17,0x20,0xC0,0x00,0x00,
};

unsigned char const zhen2[] =          // 数据表   阵
{
      0x00,0xFE,0x22,0x5A,0x86,0x04,0x84,0xE4,
      0x9F,0x84,0xF4,0x84,0xC4,0x86,0x04,0x00,
      0x00,0xFF,0x04,0x08,0x07,0x08,0x08,0x08,
      0x08,0x08,0xFF,0x08,0x08,0x0C,0x08,0x00,
};




#if 0
sbit sclk = P3 ^ 3; /*接口定义:lcd_sclk就是LCD的D6 时钟线*/
sbit sid = P3 ^ 2; /*接口定义:lcd_sid就是LCD的D7 数据输入*/
sbit di = P2 ^ 7; /*接口定义:lcd_rs就是LCD的D/I H为数据 L为指令*/
sbit rst = P3 ^ 0; /*接口定义:lcd_reset就是LCD的/RST*/
sbit cs = P3 ^ 1; /*接口定义:lcd_cs1就是LCD的cs*/

#endif

typedef struct {
	uint8_t width;
	uint8_t high;
	uint8_t curLine;
	uint8_t curCol;
}Displayer_T;


static const IO_T lcdCS = IO_INIT_TABLE(GPIOC, GPIO_PIN_7);
static const IO_T lcdRST = IO_INIT_TABLE(GPIOC, GPIO_PIN_8);
static const IO_T lcdRS = IO_INIT_TABLE(GPIOC, GPIO_PIN_9);
static const IO_T lcdSCK = IO_INIT_TABLE(GPIOC, GPIO_PIN_10);
static const IO_T lcdSDA = IO_INIT_TABLE(GPIOC, GPIO_PIN_11);

/****************************reset IC for start****************************/


void LCD_Reset()
{
	IO_Set(&lcdRST, 0);
	BSP_Delay_ms(50);
	IO_Set(&lcdRST, 1);
	BSP_Delay_ms(50);
}


//-----------------写指令或者数据--------------------	  
void write_cmd_dat(uint8_t cmda, uint8_t com)
{
	uint8_t i;
	IO_Set(&lcdRS, cmda);
	IO_Set(&lcdCS, 0);
	for(i = 0; i < 8; i++) {
		IO_Set(&lcdSDA, com & 0x80);
		BSP_Delay_us(0);
		IO_Set(&lcdSCK, 1);
		BSP_Delay_us(0);
		com <<= 1;
		IO_Set(&lcdSCK, 0);
	}
}

static void LCD_Write(uint8_t com){
	uint8_t i;
	
	IO_Set(&lcdCS, 0);
	for(i = 0; i < 8; i++) {
		IO_Set(&lcdSDA, com & 0x80);
		BSP_Delay_us(0);
		IO_Set(&lcdSCK, 1);
		BSP_Delay_us(0);
		com <<= 1;
		IO_Set(&lcdSCK, 0);
	}
}

//写指令
static void LCD_WriteCommand(uint8_t cmd){
	IO_Set(&lcdRS, 0);
	LCD_Write(cmd);
}

//写数据
static void LCD_WriteData(uint8_t data){
	IO_Set(&lcdRS, 1);
	LCD_Write(data);
}

static void LCD_Sequence(const uint8_t buf[], uint32_t len){
	uint32_t i;
	
	for(i = 0; i < len; i++){
		LCD_Write(buf[i]);
	}
}

static void LCD_DataSequence(const uint8_t buf[], uint32_t len){	
	IO_Set(&lcdRS, 1);
	LCD_Sequence(buf, len);
}

static void LCD_CommandSequence(const uint8_t buf[], uint32_t len){
	
	IO_Set(&lcdRS, 0);
	LCD_Sequence(buf, len);
}




// set Column address
void LCD_SetColumn(uint8_t column)
{
	LCD_WriteCommand(column & 0x0F); 				// Lower 4-bit
	LCD_WriteCommand((column >> 4) | 0x10);			// Higher 4-bit
}


// set page address
void LCD_SetPage(uint8_t page)
{
	LCD_WriteCommand(0xb0 + page);
}


void LCD_SetPosition(uint8_t page, uint8_t column){
	LCD_SetPage(page);
	LCD_SetColumn(column);
}

//------------------显示-------------------------

void LCD_Set(uint8_t val){
	uint8_t page;
	uint8_t col;
	for(page = 0; page < 8; page++) {
		LCD_SetPosition(page, 0);
		for(col = 0; col < 128; col++) {
			LCD_WriteData(val);
		}
	}
}

//------------------清屏-------------------------
void LCD_Clear(void){
	LCD_Set(0);
}

//------------------显示一个汉字(16 * 16)-------------------------
void LCD_Chinese(uint8_t line, uint8_t cell, const uint8_t * data)
{	
	uint8_t page = line * 2;
	uint8_t column = cell * 8;

	LCD_SetPosition(page, column);
	LCD_DataSequence(data, 16);
	LCD_SetPosition(page+1, column);
	LCD_DataSequence(data+16, 16);
}

//------------------显示一个英文字符(8 * 16)-------------------------
void LCD_Ascii(uint8_t line, uint8_t cell, const uint8_t * data)
{	
	uint8_t page = line * 2;
	uint8_t column = cell * 8;
	
	LCD_SetPosition(page, column);
	LCD_DataSequence(data, 8);
	LCD_SetPosition(page+1, column);
	LCD_DataSequence(data+8, 8);
}


//--------------LCD 控制引脚初始化----------------------------
static void LCD_IO_Init(void){
	IO_Init(&lcdCS, IO_Mode_OUT);
	IO_Init(&lcdRS, IO_Mode_OUT);
	IO_Init(&lcdRST, IO_Mode_OUT);
	IO_Init(&lcdSCK, IO_Mode_OUT);
	IO_Init(&lcdSDA, IO_Mode_OUT);
}

//--------------LCD 初始化----------------------------
void LCD_Init(void)
{
	LCD_IO_Init();
	IO_Set(&lcdCS, 0);
	LCD_Reset();
	LCD_WriteCommand(0xE2); 						//initialize interal function
	LCD_WriteCommand(0xA2); 						//LCD Bias selection(1/65 Duty,1/9Bias)  
	LCD_WriteCommand(0xA0); 						//ADC selection(SEG0->SEG128) //改变SEG扫描方向 
	LCD_WriteCommand(0xC8); 						//SHL selection(COM64->COM0) //改变COM扫描方向 
	LCD_WriteCommand(0x2F); 						//power control(VB,VR,VF=1,1,1)
	LCD_WriteCommand(0x25); 						//Regulator resistor select 110 内部电位器调节
	LCD_WriteCommand(0x81); 						//set reference voltage mode
	LCD_WriteCommand(0x21); 						//set reference voltage //改变此值可以改变效果  
	LCD_WriteCommand(0x40); 						//Initial Display Line
	LCD_WriteCommand(0xAF); 						//Display on 
	LCD_Clear();
}

/*显示*/

void Display_CharAt(uint8_t x, uint8_t y, uint32_t unicode){
	uint8_t buffer[32];
	int len = GT20L1_GetMatrixUnicode(unicode, buffer);
	if(len > 16){
		LCD_Chinese(x, y, buffer);
	}
	else{
		LCD_Ascii(x, y, buffer);
	}
}

void Display_StringAt(uint8_t x, uint8_t y, const uint8_t* data){
}

void Display_String(const uint8_t *data){

}

void Display_Locate(uint8_t x, uint8_t y){
	
}


//--------------向某页某列写数据----------------------------
void write_data(uint32_t com, uint8_t page, uint8_t column)
{
	LCD_SetPage(page);
	LCD_SetColumn(column);
	write_cmd_dat(1, com);
}


// Display data RAM page and column address
void GotoXY(uint8_t page, uint8_t column)
{
	LCD_SetPage(page);
	LCD_SetColumn(column);
}


//----------------------组装测试-------------------------
void display_test(uint8_t fst, uint8_t snd)
{
	uint8_t i, j;

	for(j = 0; j < 8; j++) {
		GotoXY(j, 0);
		for(i = 0; i < 128 / 2; i++) {
			write_cmd_dat(1, fst);
			write_cmd_dat(1, snd);
		}
	}
}


// Clear LCD screen
void Clear(void)
{
	display_test(0x00, 0x00);
	BSP_Delay_us(4);
}


// Wait some time and clear the screen
void wait_and_clear(void)
{
	BSP_Delay_ms(200);
	Clear();
}


void lcd_test()
{
	uint8_t i;
	uint8_t const tdata[][2] = {
		{
			0xff, 0xff
		},

		// All
		{
			0x00, 0x00
		},

		// None	
		{
			0x00, 0xFF
		},

		// Virtical 
		{
			0xff, 0x00
		},

		// Virtical
		{
			0xAA, 0xAA
		},

		// Horizontal 
		{
			0x55, 0x55
		},

		// Horizontal 
		{
			0xAA, 0x55
		},

		// Stars 
		{
			0x55, 0xaa
		},

		// Stars 
	};
	for(i = 0; i < 8; i++) {
		display_test(tdata[i][0], tdata[i][1]);
		BSP_Delay_ms(800);
		wait_and_clear();
	}
}


//------------------显示方框-----------------------
void lcd_kuang(void)
{
	uint8_t i, j;

	for(i = 0; i < 8; i++) {
		for(j = 0; j < 128; j++) {
			if((j == 0) || (j == 127)) {
				GotoXY(i, j);
				write_cmd_dat(1, 0xff);
			}
			if(i == 0) {
				if((j > 0) && (j < 127)) {
					GotoXY(i, j);
					write_cmd_dat(1, 0x01);
				}
			}
			if(i == 7) {
				if((j > 0) && (j < 127)) {
					GotoXY(i, j);
					write_cmd_dat(1, 0x80);
				}
			}
		}
	}
}


//------------------显示8X16点阵字符串-------------------------		
void disp_ascii0816(uint8_t * ptrAscii, uint8_t startP, uint8_t startC)
{
#if 0
	uint8_t i, xclum;
	uint32_t index;

	GotoXY(startP, startC);
	while((*ptrAscii) != '\0') {
		index = ((*ptrAscii) - 0x20) * 16;
		for(i = 0; i < 16; i++) {
			if(i % 8 == 0) {
				xclum = startC;
			}
			write_data(AsciiDot0816[index++], startP + i / 8, xclum++);
		}
		startC += 8;
		ptrAscii++;

		//	if((128-xclum)<8)
		//	{
		// startP+=2;
		//	 startC=0;
		//if(startP<8)
		//	 {Gotoxy(startP,startC);}
		//	}
	}
#endif
}


//------------------显示5X8点阵字库串-------------------------
void disp_ascii0508(uint8_t * ptrAscii, uint8_t startP, uint8_t startC)
{
#if 0
	uint8_t i;
	uint32_t index;

	GotoXY(startP, startC);
	while((*ptrAscii) != '\0') {
		index = ((*ptrAscii) - 0x20) * 5;
		for(i = 0; i < 5; i++) {
			write_data(AsciiDot0508[index++], startP, startC++);
		}
		ptrAscii++;
		if((128 - startC) < 6) {
			startP++;
			startC = 0;
			if(startP < 8) {
				GotoXY(startP, startC);
			}
		}
	}
#endif
}


//------------------显示一个汉字-------------------------
void display_hanzi(const uint8_t * p, uint8_t startP, uint8_t startC)
{
	uint8_t i, j;

	for(i = 0; i < 2; i++) {
		GotoXY(startP + i, startC);
		for(j = 0; j < 16; j++) {
			write_cmd_dat(1, *p++);
		} //发送数据
	}
}


//------------------显示一个反白汉字-------------------------
void display_hanzi_fan(const uint8_t * p, uint8_t startP, uint8_t startC)
{
	uint8_t i, j;

	for(i = 0; i < 2; i++) {
		GotoXY(startP + i, startC);
		for(j = 0; j < 16; j++) {
			write_cmd_dat(1, ~ *p++);
		} //发送数据
	}
}


//-------------显示一副128X64点阵的图片------------------------------
void display_photo(uint8_t * p, uint8_t startP, uint8_t startC)
{
	uint8_t i, j;

	GotoXY(startP, startC);
	for(i = 0; i < 8; i++) {
		for(j = 0; j < 128; j++) {
			write_data(*p++, startP + i, startC + j);
		}
	}
}


void Init_IC()
{
	LCD_IO_Init();

	//	 cs  =	0;	 
	//	 P1  =	0xFF;	
	IO_Set(&lcdCS, 0);
	LCD_Reset();
	write_cmd_dat(0, 0xE2); 						//initialize interal function
	write_cmd_dat(0, 0xA2); 						//LCD Bias selection(1/65 Duty,1/9Bias)  
	write_cmd_dat(0, 0xA0); 						//ADC selection(SEG0->SEG128) //改变SEG扫描方向 
	write_cmd_dat(0, 0xC8); 						//SHL selection(COM64->COM0) //改变COM扫描方向 
	write_cmd_dat(0, 0x2F); 						//power control(VB,VR,VF=1,1,1)
	write_cmd_dat(0, 0x25); 						//Regulator resistor select 110 内部电位器调节
	write_cmd_dat(0, 0x81); 						//set reference voltage mode
	write_cmd_dat(0, 0x21); 						//set reference voltage //改变此值可以改变效果  
	write_cmd_dat(0, 0x40); 						//Initial Display Line
	write_cmd_dat(0, 0xAF); 						//Display on 
	Clear();
}


void lcd_main(void)
{
	//	uint32_t i;
	Init_IC();
	while(1) {
		//	  LED = 0;
		//	  BSP_Delay_ms(500);
		//	   LED = 1;
		//	  BSP_Delay_ms(500);
		//		LED = 0;
		lcd_kuang();
		BSP_Delay_ms(800);
		Clear();
		lcd_test(); 								// lcd 组装测试

		//横向显示	 
		display_hanzi(shen, 0, 0);					//显示16X16点阵汉字
		display_hanzi(zhen, 0, 16);
		display_hanzi(chuan, 0, 32);
		display_hanzi(hang, 0, 48);
		display_hanzi(dian, 0, 64);
		display_hanzi(zi, 0, 80);
		display_hanzi(ke, 0, 96);
		display_hanzi(ji, 0, 112);
#if 0
		disp_ascii0816("CH12864-9COG", 2, 0);
		display_hanzi(gong, 2, 96);
		display_hanzi(yi, 2, 112);
		display_hanzi_fan(dian2, 4, 0);
		display_hanzi_fan(zhen2, 4, 16);
		disp_ascii0816(":", 4, 32);
		disp_ascii0816("128x64", 4, 48);

		//	disp_ascii0816("ST7565R-",4,0);
		//	display_hanzi(bing,4,64);
		//	display_hanzi(kou,4,80);
		//	display_hanzi(chuan1,4,96);
		//	display_hanzi(kou,4,113);
		display_hanzi_fan(shi, 6, 0);
		display_hanzi_fan(qu, 6, 16);
		disp_ascii0816(":", 6, 32);
		disp_ascii0508("53.6 * 28.6 mm", 6, 48);
		disp_ascii0508("53.6 * 28.6 mm", 7, 48);
#endif

		BSP_Delay_ms(1500);
		Clear();

#if 0
		display_photo(tupian, 0, 0);				//显示一副128X64点阵的图片 横向显示
		BSP_Delay_ms(1500);
		Clear();

		//纵向显示	 
		display_hanzi(SHEN1, 0, 0); 				//显示16X16点阵汉字
		display_hanzi(ZHENG1, 0, 16);				//显示16X16点阵汉字
		display_hanzi(CUAN1, 0, 32);
		display_hanzi(HANG1, 0, 48);
		display_hanzi(DIAN1, 0, 64);
		display_hanzi(ZI1, 0, 80);
		display_hanzi(KE1, 0, 96);
		display_hanzi(JI1, 0, 112);
		display_hanzi(SHEN1, 2, 0); 				//显示16X16点阵汉字
		display_hanzi(ZHENG1, 2, 16);				//显示16X16点阵汉字
		display_hanzi(CUAN1, 2, 32);
		display_hanzi(HANG1, 2, 48);
		display_hanzi(DIAN1, 2, 64);
		display_hanzi(ZI1, 2, 80);
		display_hanzi(KE1, 2, 96);
		display_hanzi(JI1, 2, 112);
		display_hanzi(SHEN1, 4, 0); 				//显示16X16点阵汉字
		display_hanzi(ZHENG1, 4, 16);				//显示16X16点阵汉字
		display_hanzi(CUAN1, 4, 32);
		display_hanzi(HANG1, 4, 48);
		display_hanzi(DIAN1, 4, 64);
		display_hanzi(ZI1, 4, 80);
		display_hanzi(KE1, 4, 96);
		display_hanzi(JI1, 4, 112);
		display_hanzi(SHEN1, 6, 0); 				//显示16X16点阵汉字
		display_hanzi(ZHENG1, 6, 16);				//显示16X16点阵汉字
		display_hanzi(CUAN1, 6, 32);
		display_hanzi(HANG1, 6, 48);
		display_hanzi(DIAN1, 6, 64);
		display_hanzi(ZI1, 6, 80);
		display_hanzi(KE1, 6, 96);
		display_hanzi(JI1, 6, 112);
		BSP_Delay_ms(1500);
#endif

		Clear();

		//	   
		//	 display_photo(tupian1,0,0);	   //显示一副128X64点阵的图片 纵向显示 
		//		BSP_Delay_ms(1500);
		//	 Clear();
	}
}


static void LCD_Test(void)
{
	//	uint32_t i;
	LCD_Init();
	while(1) {
		//横向显示	 
		LCD_Chinese(0, 0, shen);
		LCD_Chinese(0, 2, chuan);
		LCD_Chinese(0, 4, hang);
		LCD_Chinese(0, 6, dian);
		LCD_Chinese(0, 8, zi);
		LCD_Chinese(0, 10, ke);
		LCD_Chinese(0, 12, ji);
		LCD_Chinese(0, 12, yi);

		Display_CharAt(1, 0, 'A');
		Display_CharAt(1, 1, '我');
		
		BSP_Delay_ms(1500);
		Clear();
		BSP_Delay_ms(1000);
	}
}


void TestDisplay(void)
{
	while(1) {
		LCD_Test();
//			lcd_main();
	}
}


#endif

